def run(params:list[str]):
    from ApiTools import apiTools,apiBase
    try:
        name=apiBase.argv(params,1,"read-table-ddl")
        code='''
def getpsql_table_ddl(param):
    from sqlalchemy import create_engine, MetaData, Table
    list=param.split(",")
    print(list)
    engine = create_engine(list[0])
    # 反射数据库中的表
    metadata = MetaData()
    metadata.reflect(bind=engine)
    # 获取反射的表            
    example_table = metadata.tables[list[1]]
    # 获取DDL语句
    with engine.connect() as conn:
        ddl_script = str(example_table.create(conn))        
    return ddl_script
'''
        code=apiBase.argv(params,2,code)
        desc=apiBase.argv(params,3)
        if not desc:
            desc=name
        tol = apiTools.load_tol()
        ret = tol.load_code(name,code)
        if not ret :
            return 'load code ok'
        else:
            return ret
    except Exception as e:
        return f"function error:{e}"

#run([])